#!/usr/bin/env python  
# encoding: utf-8   

""" 
@version: v1.0 
@author: null 
@software: PyCharm 
@file: testmain.py 
@time: 2017.4.29 11:09 
"""

import weibo.db.ims as pic
from PIL import Image

if __name__ == "__main__":
    ims = pic.ims
    im = Image.open("bb.png").convert('L')
    width = im.size[0]
    height = im.size[1]
    png = ims.get("4321")
    count = 0
    for i in range(width):
        for j in range(height):
            print(im.load()[i,j],end='   ')
            print(png[i][j],end='   ')
            print(im.load()[i,j]-png[i][j])
            if abs(im.load()[i,j]-png[i][j])>30:
                count=count+1
    print(count)
    '''for i in range(width):
        for j in range(height):
            #print(im.load()[i,j])
            #print(ims[png][i][j])
            im.load()[i, j] = png[i][j]
    im.save("new.png")'''
    pass
